.TH std::thread::hardware_concurrency 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::thread::hardware_concurrency \- std::thread::hardware_concurrency

.SH Synopsis
   static unsigned int hardware_concurrency() noexcept;  \fI(since C++11)\fP

   Returns the number of concurrent threads supported by the implementation. The value
   should be considered only a hint.

.SH Parameters

   \fI(none)\fP

.SH Return value

   Number of concurrent threads supported. If the value is not well defined or not
   computable, returns 0.

.SH Example


// Run this code

 #include <iostream>
 #include <thread>

 int main()
 {
     unsigned int n = std::thread::hardware_concurrency();
     std::cout << n << " concurrent threads are supported.\\n";
 }

.SH Possible output:

 4 concurrent threads are supported.

.SH See also

   hardware_destructive_interference_size  min offset to avoid false sharing
   hardware_constructive_interference_size max offset to promote true sharing
   \fI(C++17)\fP                                 (constant)
